<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>img在div中的间隙问题</title>
    <style>
        div{
            background: red;
            /* 1.给父元素设置font-size:0 */
            /* font-size: 0; */
        }
        /* 2.给img设置vertical-align：bottom; */
        img{
            vertical-align: bottom;
        }
    </style>
</head>
<body>
    <div>
        <img src="images/bg.jpg" alt="">
    </div>
</body>
</html>